﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using B.S.Warehouse.Domain;
using B.S.Warehouse.ErrorCord;
using B.S.Warehouse.Read.Api.Application.Command.StockInApplicationcommands;
using B.S.Warehouse.Read.Api.Application.Command.StockInDetailCommand;

namespace B.S.Warehouse.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class GetmController : ControllerBase
    {
        private readonly IMediator mediator;
        private readonly ISqlSugarClient db;
        public GetmController(IMediator mediator, ISqlSugarClient db)
        {
            this.mediator = mediator;
            this.db = db;
        }
        /// <summary>
        /// 入库申请主表显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<ApiPaging<StockInApplication>>> GetStockInApplication([FromQuery]GetStockInApplicationCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        ///  入库申请主表反填
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<StockInApplication>>> FTStockInApplication([FromQuery]FTStockInApplicatiCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 入库申请子表显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<StockInDetailS>>> GetStockInDetail([FromQuery]GetStockInDetailCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 入库申请子表分页
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<StockInDetailS>>> FTStockInDetail([FromQuery]FTStockInDetailCommand request)
        {
            return await mediator.Send(request);
        }

    }
}
